import { createRouter, createWebHistory } from 'vue-router';
import PracticePage from '../components/PracticePage.vue';
import HeroSection from '../components/HeroSection.vue';
import CourseManager from '../components/CourseManager.vue';
import KnowledgeGraph from '../components/KnowledgeGraph.vue';
import KnowledgeSection from '../components/KnowledgeSection.vue';
import QuestionManagement from '../components/QuestionManagement.vue';
import ExercisePage from '../components/ExercisePage.vue';
import PracticeGraph from '../components/PracticeGraph.vue';
import UserManagement from '../components/UserManagement.vue';
import MyPage from '../components/MyPage.vue';

import MainHome from '../components/MainHome.vue';
import VideoTeaching from '@/views/VideoTeaching.vue';

const routes = [
  {
    path: '/smart-preparation',
    name: 'SmartPreparation',
    component: () => import('../views/SmartPreparation.vue') // 假设文件存在于 src 目录下
  },
  {
    path: '/',
    name: 'HeroSection',
    component: HeroSection,
    meta: { hideNavbar: true }
  },
  {
    path: '/login',
    name: 'UserLogin',
    component: () => import('../components/Login.vue'),
    meta: { hideNavbar: true }  // 添加 meta 字段，设置隐藏导航栏
  },
  {
    path: '/register',
    name: 'UserRegister',
    component: () => import('../components/Register.vue'),
    meta: { hideNavbar: true }  // 注册页面也隐藏导航栏
  },
  {
    path: '/forget',
    name: 'PasswordForget',
    component: () => import('../components/ForgotPassword.vue'),
    meta: { hideNavbar: true }  // 忘记密码页面也隐藏导航栏
  },
  {
    path: '/home',
    name: 'MainHome',
    component: MainHome,
    meta: { hideNavbar: false }
  },
  {
    path: '/courses',
    name: 'CourseManager',
    component: CourseManager
  },
  {
    path: '/knowledge',
    name: 'Knowledge',
    component: KnowledgeGraph  
  },
  {
    path: '/course-detail',
    name: 'CourseDetail',
    component: KnowledgeSection  // 添加课程详情页路由
  },
  {
    path: '/knowledge-points', 
    name: 'KnowledgeSection',
    component: KnowledgeSection
  },
  {
    path: '/knowledge-graph',
    name: 'KnowledgeGraph',
    component: KnowledgeGraph
  },
  {
    path: '/questions',
    name: 'QuestionManagement',
    component: QuestionManagement
  },
  {
    path: '/ai-generate',
    name: 'AIGeneration',
    component: () => import('../components/AIGeneration.vue')
  },
  {
    path: '/practice',
    name: 'PracticePage',
    component: PracticePage
  },
  {
    path: '/exercise/:id',
    name: 'Exercise',
    component: ExercisePage,
    props: true
  },
  {
    path: '/video-teaching',
    name: 'VideoTeaching',
    component: VideoTeaching
  },
  
  {
    path: '/practice-graph',
    name: 'PracticeGraph',
    component: PracticeGraph
  },
  // 添加用户管理路由
  {
    path: '/user-management',  // 与导航栏映射的路径一致
    name: 'UserManagement',
    component: UserManagement  // 绑定组件
  },
  {
    path: '/MyPage',
    name: 'MyPage',
    component: MyPage
  },
  {
    path: '/about',
    name: 'AboutUs',
    component: () => import('../components/AboutUs.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;